package ie.lawlor.amvc.event;

/**
 * @author blawlor
 *
 */
public class EventName {
	public final static String NONAMESPACE = "<default>";
	
	public String nameSpace = NONAMESPACE;
	public String name = "";
	
	public EventName(String nameSpace, String name){
		this.nameSpace = nameSpace;
		this.name = name;
	}
	
	public EventName(String name){
		this.name = name;
	}
	
	public EventName(){
	}
	
	public boolean equals(Object o){
		if (o instanceof EventName){
			EventName en = (EventName)o;
			return (en.name.equals(name) && 
				 en.nameSpace.equals(nameSpace));
		} else {
			return false;
		}
	}
	
	public int hashCode(){
		return (name+nameSpace).hashCode();
	}
	
	public String toString(){
		return nameSpace + "::" + name;
	}
	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return Returns the nameSpace.
	 */
	public String getNameSpace() {
		return nameSpace;
	}
	/**
	 * @param nameSpace The nameSpace to set.
	 */
	public void setNameSpace(String nameSpace) {
		this.nameSpace = nameSpace;
	}
}
